﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public enum ErrorCode {
	Success = 0,
	Fail = 1,

	UserName_Low = 101,	
	UserName_Format = 102,
	UserName_Exist = 103,

	Password_Low = 201,
	Password_Fromat = 202,
	Password_Error = 203,

	Phone_Format = 301,
	Phone_Exist = 302,
	Phone_NoExist = 303,
}

public class ErrorMsg : SystemLib.Pattern.Singleton<ErrorMsg>
{
	private Dictionary<ErrorCode, string> m_ErrorMsg = new Dictionary<ErrorCode, string>();

	public ErrorMsg()
	{
		m_ErrorMsg[ErrorCode.UserName_Low] = "姓名太短或太长，请重新输入";
		m_ErrorMsg[ErrorCode.UserName_Format] = "姓名格式错误，请重新输入";
		m_ErrorMsg[ErrorCode.UserName_Exist] = "姓名已经存在，请重新输入";

		m_ErrorMsg[ErrorCode.Password_Low] = "密码太短或太长，请重新输入";
		m_ErrorMsg[ErrorCode.Password_Fromat] = "密码格式不正确，请重新输入";
		m_ErrorMsg[ErrorCode.Password_Error] = "密码错误，请重新输入";

		m_ErrorMsg[ErrorCode.Phone_Format] = "手机号格式不正确，请重新输入";
		m_ErrorMsg[ErrorCode.Phone_Exist] = "手机号已经存在，请重新输入";
		m_ErrorMsg[ErrorCode.Phone_NoExist] = "手机号不存在，请重新输入";
	}

	public string GetMsg(ErrorCode errorCode)
	{
		if (!m_ErrorMsg.ContainsKey(errorCode))
			return string.Empty;

		return m_ErrorMsg[errorCode];
	}
}
